<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        // catch的使用等同于promise对象.then(undefined,function(){})或者promise对象.then(null,function(){})
        let p=new Promise(function(resolve,reject){
            reject("哈哈哈哈");
        });
        // p.then(function(){

        // },function(data){
        //     console.log(data);
        // });

        // p.catch(function(data){
        //     console.log(data)
        // });

        // Promise内部的错误不会影响到Promise外部的代码，通俗的说法"Promise 会吃掉错误"
        p.then(function(){
            console.log("resolve");
        }).catch(function(){
            console.log("reject");
        }).then(function(){
            var str="msg";
            consoe.log(str);
        }).catch(function(e){
            console.log(e);
        });
        var i=10;
        console.log(i);

    </script>
</head>
<body>
    
</body>
</html>